// HarrFeatures.cpp: implementation of the CHarrFeatures class.
//
//////////////////////////////////////////////////////////////////////

#include "HarrFeatures.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CHarrFeatures::CHarrFeatures()
{
}

CHarrFeatures::~CHarrFeatures()
{
}

//
// w, h: image dimension
//
void CHarrFeatures::Generate(int imgw, int imgh)
{
	int type, x, y, w, h, d = 6;

	int n = 0;
	int inc = d / 2;

	type = 1;
	for (w = d; w <= imgw / 2; w+=inc)
		for (h = d; h <= imgh; h+=inc)
			for (x = 0; x <= imgw - w * 2; x+=inc)
				for (y = 0; y <= imgh - h; y+=inc)
				{
					CHarrFeature harr(type, w, h, x, y);
					m_vHarr.push_back(harr);
					n++;
				}

	type = 2;
	for (w = d; w <= imgw; w+=inc)
		for (h = d; h <= imgh / 2; h+=inc)
			for (x = 0; x <= imgw - w; x+=inc)
				for (y = 0; y <= imgh - h * 2; y+=inc)
				{
					CHarrFeature harr(type, w, h, x, y);
					m_vHarr.push_back(harr);
					n++;
				}

	type = 3;
	for (w = d; w <= imgw / 3; w+=inc)
		for (h = d; h <= imgh; h+=inc)
			for (x = 0; x <= imgw - w * 3; x+=inc)
				for (y = 0; y <= imgh - h; y+=inc)
				{
					CHarrFeature harr(type, w, h, x, y);
					m_vHarr.push_back(harr);
					n++;
				}

	type = 4;
	for (w = d; w <= imgw / 2; w+=inc)
		for (h = d; h <= imgh / 2; h+=inc)
			for (x = 0; x <= imgw - w * 2; x+=inc)
				for (y = 0; y <= imgh - h * 2; y+=inc)
				{
					CHarrFeature harr(type, w, h, x, y);
					m_vHarr.push_back(harr);
					n++;
				}
}
